import {createRouter, createWebHistory} from 'vue-router';
import UserLogin from '../views/UserLogin/Login.vue';
import UserRegister from '../views/UserLogin/Register.vue';
import Home from '../views/Home.vue';
import Novels from '../views/Novel/Novels.vue';
import Users from '../views/Management/Users.vue';
import Reports from '../views/Management/Reports.vue';
import NovelDetail from '../views/Novel/NovelDetail.vue';
import ChangeAvatar from '../views/User/ChangeAvatar.vue';
import ResetPassword from '../views/User/ResetPassword.vue';
import UserInfo from '../views/User/UserInfo.vue';
import MyComments from "@/views/MyCommentsAndReports/MyComments.vue";
import MyReports from "@/views/MyCommentsAndReports/MyReports.vue";
import UploadNovel from "@/views/Novel/UploadNovel.vue";
import CheckNovel from "@/views/Management/CheckNovel.vue";
import ManageNnovels from "@/views/Management/ManageNnovels.vue";

const routes = [
    {
        path: '/user/login',
        name: 'UserLogin',
        component: UserLogin
    },
    {
        path: '/user/register',
        name: 'UserRegister',
        component: UserRegister
    },
    {
        path: '/',
        name: 'Novels',
        component: Novels
    },
    {
        path: '/novel/:id',
        name: 'NovelDetail',
        component: NovelDetail
    },
    {
        path: '/home',
        name: 'Home',
        component: Home,
        children: [
            {
                path: 'novels',
                name: 'Novels',
                component: Novels
            },
            {
                path: 'uploadNovel',
                name: 'UploadNovel',
                component: UploadNovel
            },
            {
                path: 'myComments',
                name: 'MyComments',
                component: MyComments
            },
            {
                path: 'myReports',
                name: 'MyReports',
                component: MyReports
            },
            {
                path: 'users',
                name: 'Users',
                component: Users
            },
            {
                path: 'manageNnovels',
                name: 'ManageNnovels',
                component: ManageNnovels
            },
            {
                path: 'checkNovel',
                name: 'CheckNovel',
                component: CheckNovel
            },
            {
                path: 'reports',
                name: 'Reports',
                component: Reports
            },
            {
                path: 'changeAvatar',
                name: 'ChangeAvatar',
                component: ChangeAvatar
            },
            {
                path: 'resetPassword',
                name: 'ResetPassword',
                component: ResetPassword
            },
            {
                path: 'info',
                name: 'UserInfo',
                component: UserInfo
            }
        ]
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes
});

export default router;